import request from '../../utils/httpRequest'

const attrgroup = '/product/product/attrgroup'

// 查询list
export function getAttrGroupList (params, id) {
  return request({
    url: `${attrgroup}/list/${id}`,
    method: 'get',
    params: params
  })
}

// 查询分类id下的所有属性分组以及属性分组下的所有属性
export function getAttrGroupWithAttrs (id) {
  return request({
    url: `${attrgroup}/${id}/with/attr`,
    method: 'get'
  })
}

// 根据ids批量删除
export function deleteAttrGroupByIds (data) {
  return request({
    url: `${attrgroup}/delete`,
    method: 'delete',
    data
  })
}

// 根据id查询
export function getAttrGroupAndCatelogPathById (id) {
  return request({
    url: `${attrgroup}/info/${id}`,
    method: 'get'
  })
}

// 新增
export function saveAttrGroup (data) {
  return request({
    url: `${attrgroup}/save`,
    method: 'post',
    data
  })
}

// 修改
export function updateAttrGroup (data) {
  return request({
    url: `${attrgroup}/update`,
    method: 'put',
    data
  })
}
